﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    public enum e
    {
        石头 = 1,
        剪刀,
        布
    }
    public enum e1
    {
        刘备=1,
        曹操 = 2,
        孙权,
        
    }
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("《---------------欢迎来到游戏世界---------------》");
            Console.WriteLine("******************************************");
            Console.WriteLine("******************猜拳开始****************");
            Console.WriteLine("******************************************");
            Console.WriteLine("出拳规则：1.石头，2.剪刀，3.布");
            Console.WriteLine("请选择敌方： 1.刘备，2.孙权，3.曹操");
            int num = int.Parse(Console.ReadLine());
          
            switch (num)
            {
               
         
                case 1:
                   
                    test();
                    break;

                case 2:
                    test();
                    break;

                case 3:
                    test();

                    break;

            }


        }
        static void test()
        {
            ArrayList array = new ArrayList();
            people pe = new people();
            pe.Name = "刘备";
            people pe1 = new people();
            pe1.Name = "孙权";
            people pe2 = new people();
            pe2.Name = "曹操";
            array.Add(pe);
            array.Add(pe1);
            array.Add(pe2);
            int SUM = 0;
            int A = 0;
            int B = 0;
            Random r = new Random();
            Console.WriteLine("请输入你的姓名");
            string a = Console.ReadLine();
            Console.WriteLine(a + " VS " + pe.Name);
           
            Console.WriteLine();
          
            Console.WriteLine("开始游戏吗Y/N");
          string  d = Console.ReadLine();
            if (d == "Y")
            {
                Console.WriteLine("请出拳：1.石头，2.剪刀，3.布（输入相应数字）");
                int num2 = int.Parse(Console.ReadLine());
                SUM++;
                if (num2 == (int)e.石头)
                {
                    Console.WriteLine(a + " ：石头 ");
                    Console.WriteLine();
                    if (num2 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;

                    }
                    else if (num2 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }

                if (num2 == (int)e.剪刀)
                {
                    if (num2 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                    else if (num2 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                }
                if (num2 == (int)e.布)
                {


                    if (num2 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                    else if (num2 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }
            }
            else if (d == "N")
            {
                Console.WriteLine("退出成功");

            }
            Console.WriteLine("是否开始游戏吗Y/N");
            String C = Console.ReadLine();
            SUM++;
            if (C == "Y")
            {
                Console.WriteLine("请出拳：1.石头，2.剪刀，3.布（输入相应数字）");
                int num3 = int.Parse(Console.ReadLine());
                if (num3 == (int)e.石头)
                {
                    Console.WriteLine(a + " ：石头 ");
                    Console.WriteLine();
                    if (num3 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "输了你是大笨蛋");

                        B++;
                    }
                    else if (num3 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }
                if (num3 == (int)e.剪刀)
                {
                    if (num3 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                    else if (num3 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                }

                if (num3 == (int)e.布)
                {


                    if (num3 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                    else if (num3 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }

            }
            else if (d == "N")
            {
                Console.WriteLine("退出成功");

            }
            Console.WriteLine("是否开始游戏吗Y/N");
            String CC = Console.ReadLine();
            SUM++;
            if (CC == "Y")
            {
                Console.WriteLine("请出拳：1.石头，2.剪刀，3.布（输入相应数字）");
                int num4 = int.Parse(Console.ReadLine());
                if (num4 == (int)e.石头)
                {
                    Console.WriteLine(a + " ：石头 ");
                    Console.WriteLine();
                    if (num4 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                    else if (num4 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }

                if (num4 == (int)e.剪刀)
                {
                    if (num4 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                    else if (num4 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                }
                if (num4 == (int)e.布)
                {

                    if (num4 < r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.剪刀);
                        Console.WriteLine(a + "输了你是大笨蛋");
                        B++;
                    }
                    else if (num4 == r.Next((int)1.4))
                    {
                        Console.WriteLine(pe.Name + ": " + e.布);
                        Console.WriteLine(a + "平局不要打了");
                    }
                    else
                    {
                        Console.WriteLine(pe.Name + ": " + e.石头);
                        Console.WriteLine(a + "赢了你是大哥大");
                        A++;
                    }
                }
            }

            else if (d == "N")
            {
                Console.WriteLine("退出成功");
               
            }
            Console.WriteLine("-------------------------------");
            Console.WriteLine("对战次数" + SUM);
            Console.WriteLine("姓名", "得分");
            Console.WriteLine(a + "次数"+A);
            Console.WriteLine(pe.Name + "次数" + B);
            if (A>B)
            {
                Console.WriteLine(a+":赢咯");

            }
            else
            {
                Console.WriteLine(B+ ":赢咯");
            }
 
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("是否开始游戏吗Y/N");
            string qq = Console.ReadLine();
            if (qq == "Y")
            {
                Console.WriteLine("玩个屁");
            }
            else
            {
                Console.WriteLine("休息休息休息休息");
            }
        }
            }
        }
    

